<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="../templates/principal.xhtml">

    <ui:define name="content" id="content">
        <h1 class="title ui-widget-header ui-corner-all">Bem Vindo a Listagem de Vendas</h1>

        <p:ajaxStatus onstart="statusDialog.show();" onsuccess="statusDialog.hide();"/>

        <p:dialog modal="true" widgetVar="statusDialog" header="Aguarde ... Processando ..." draggable="false" closable="false">
            <p:graphicImage value="/design/ajaxloadingbar.gif" />
        </p:dialog>

        <h:form id="frmRelVenda" prependId="false">
            <div id="limites">
                <div id="conteudo">
                    <p:panel id="panel" header="Impressão Relatório das Vendas" style="text-align: center">
                        <div align="center">
                            <h:panelGrid id="display" columns="2" style="margin-bottom:50px" cellpadding="5" columnClasses="coluna1, coluna2">
                                <h:outputText value="Data Transferência:" />
                                <p:calendar id="filtro" locale="pt" value="#{relatorioVendasBean.datrel}" pattern="dd/MM/yyyy" style="font-weight:bold;" />

                                <h:outputText value="Imprime Participação Acionária:" />
                                <h:selectOneRadio id="imppartic" value="#{relatorioVendasBean.imppartic}">
                                    <f:selectItem itemLabel="Sim" itemValue="S" />
                                    <f:selectItem itemLabel="Não" itemValue="N" />
                                </h:selectOneRadio>
                                
                                <h:outputText value="Imprime Proposta de Compra:" />
                                <h:selectOneRadio id="impproposta" value="#{relatorioVendasBean.impproposta}">
                                    <f:selectItem itemLabel="Sim" itemValue="S" />
                                    <f:selectItem itemLabel="Não" itemValue="N" />
                                </h:selectOneRadio>
                                
                                <h:outputText value="Imprime Observação:" />
                                <h:selectOneRadio id="impobs" value="#{relatorioVendasBean.impobs}">
                                    <f:selectItem itemLabel="Sim" itemValue="S" />
                                    <f:selectItem itemLabel="Não" itemValue="N" />
                                </h:selectOneRadio>
                                
                                <f:facet name="footer">
                                    <p:dataTable id="tabTransferencia" widgetVar="tabTransferencia" var="venda" value="#{relatorioVendasBean.lazyModelCautela}" 
                                                 paginator="true" rows="5" selection="#{relatorioVendasBean.selectedCautela}" lazy="true"
                                                 emptyMessage="Nenhum Acionista Selecionado ...">

                                        <p:column selectionMode="single" style="width:18px" />

                                        <p:column headerText="Acionista Cedente" sortBy="#{venda.idCliente.nomCliente}" filterBy="#{venda.idCliente.nomCliente}">
                                            <h:outputText value="#{venda.idCliente.nomCliente}" />
                                        </p:column>

                                    </p:dataTable>
                                </f:facet>
                            </h:panelGrid>
                            
                            <p:commandButton value="Gerar Relatório" update="messages, panel" actionListener="#{relatorioVendasBean.gerarVenda}" />
                            <p:commandButton value="Imprimir Relatório" update="messages" onclick="submitform('#{request.contextPath}/relatorio','vendas')" />

                            <div id="conexao" name="conexao" style="visibility:hidden" align="center">
                                <p:fieldset legend="Aguarde ...">
                                    <img src="images/comunicacao.gif" width="200" height="100" alt="comunicacao"/>
                                </p:fieldset>
                            </div>
                        </div>
                    </p:panel>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>